<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<html>
<head>
	
</head>
<body>
	<link href="//cdn.bootcss.com/bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet">
	<script src="//cdn.bootcss.com/bootstrap/3.0.1/js/bootstrap.min.js"></script>
	<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<link href="http://cdn.bootcss.com/bootstrap-table/1.9.1/bootstrap-table.min.css" rel="stylesheet"/>


<script src="http://cdn.bootcss.com/bootstrap-table/1.9.1/bootstrap-table.min.js"></script>
<script src="http://cdn.bootcss.com/bootstrap-table/1.9.1/locale/bootstrap-table-zh-CN.min.js"></script>

<div class="container" style="margin-top: 20px;">
    <div class="row">
        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title" style="display: inline-block">
                    收藏列表
                </h3>
                <span id="del-collect" class="btn btn-warning" style="float:right;padding:0px 15px;">一键删除失效商品收藏</span>
            </div>
            <div class="panel-body">
                <table id="table" data-click-to-select="true"
                       data-single-select="true">

                </table>
            </div>
        </div>
    </div>
</div>
<script>
    var row_data={};
    $( function() {

        $("#del-collect").click(function(){
            $.post("/index.php?m=member&c=member&a=delNoGoodsCollects&type=data&pc_hash="+"<?php echo $_SESSION['pc_hash']?>",{},function(data){
                console.info(data)
                alert('删除成功')
                window.location.reload()
            },'json')
        })
        var $table = $( '#table' );

        $table.bootstrapTable( {
            url                : "/index.php?m=member&c=member&a=getCollectList&type=data&pc_hash="+"<?php echo $_SESSION['pc_hash']?>",
             dataType           : "json",
            toolbar            : '#toolbar',    //工具按钮用哪个容器
            striped            : true,      //是否显示行间隔色
            pagination         : true, //分页
            singleSelect       : true,
            check              : 1,
            pageList           : [5, 10, 15, 20],
            pageSize           : 500,
            pageNumber         : 1,
            clickToSelect      : true,    //是否启用点击选中行
            uniqueId           : "id",
            showToggle         : true,     //是否显示详细视图和列表视图的切换按钮
            cardView           : false,     //是否显示详细视图
            detailView         : false,     //是否显示父子表
            sidePagination     : "server",
            onClickRow:function(row,$element){
                row_data=row;
            },
            //data-locale:"zh-US" , //表格汉化
            //search             : true, //显示搜索框
            queryParams        : function( params ) {
                return {
                    search: $( ".search .form-control" ).val(),
                    limit : params.limit,
                    offset: params.offset
                };
            },
            showColumns        : true,
            showRefresh        : true,
            minimumCountColumns: 2,
            clickToSelect      : true,
            smartDisplay       : true,
            columns            : [
               
                {
                    title: 'ID',
                    field: 'userid'
                },
                {
                    title: '用户名',
                    field: 'nickname',
                },
                {
                    title    : '商品编号标题',
                    field    : 'title',
                    formatter: function( value, row, index ) {
                        return "<a target='_blank' href='"+row.real_url+"'>" + value + "</a>"
                    }
                },
                {
                    title: '价格',
                    field: 'price',
                },
                {
                    title: '栏目',
                    field: 'cat_name',
                },
                {
                    title: '邮箱',
                    field: 'email',
                },
                {
                    title: '用户手机号',
                    field: 'mobile',
                },
                /*{
                    title: '查看商品',
                    field: 'url',
                    formatter: function( value, row, index ) {
                        var e = '<a target="_blank" href="'+value+'">查看商品</a> ';
                        
                        return e ;
                    }
                },*/
                {
                    title: '收藏时间',
                    field: 'tianjiatime',
                    
                },
                
            ]
        } );

    } )
    </script>
</body>
</html>